home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / zmenu_v2.zip / ZMENU.T < prev    next >
Text File  |  1990-04-25  |  32KB  |  814 lines

  1.  :  ZMENU.T  ZCOMM Version 2 90-05-01
  2.  :  previous verions V1 V1A superseded
  3.  :: modem assumed to support full Hayes set.  Limited modem support.
  4.  :  Author:  Bruce E. Högman, 629 S. 24th St., Arlington VA 22202-2525
  5.  :   Phone:  (703) 685-4926 (home)  (703) 644-5200x6470 (work)
  6.  :   FAX:    (703) 685-0478 (home)
  7.  :  Users are encouraged to contact the author with suggestions.
  8.  :  See ZMENU.DOC
  9.  ::
  10.  ::===  Symbols used within zmenu.t
  11.  ::
  12.  :: Labels contained in zmenu.t
  13.  ::
  14.  ::   setup          initializes menu system.  Called by ZCOMM at start,
  15.  ::                  if phones set to zmenu.t
  16.  ::                  setup processing also results in a zmnuparm.t
  17.  ::                  script which is used for all future startups.
  18.  ::                  to alter zmnuparm.ini, edit it, then del zmnuparm.t
  19.  ::                  and call setup.
  20.  ::
  21.  ::   bbs            Direct entry into BBS menu (only after setup)
  22.  ::   boards         Direct entry into BBS menu (only after setup)
  23.  ::
  24.  ::   displayreset   resets display to value in zmnuparm.ini,
  25.  ::                  cancels keyboard customization using 'mk' cmd
  26.  ::
  27.  ::   hangup         puts modem into command mode and issues ATH
  28.  ::
  29.  ::   inigrab        grabs parameters from zmnuparm.ini file
  30.  ::                  (like win.ini for windows, you know)
  31.  ::
  32.  ::   offyam         what do you want to do upon "off" command?
  33.  ::
  34.  ::   online         call online when you tromp on script or
  35.  ::                  exit to command mode.  this is easy return to
  36.  ::                  term mode.
  37.  ::
  38.  ::   your_name      your system names to call.  make a label for the
  39.  ::                  system name, then:  your_name goback rmtcall.
  40.  ::                  ZCOMM nicely sets string 'remote' to your_name,
  41.  ::                  and the 'rmtcall' script carries on from there.
  42.  ::                  You will, however, also need an entry in zmnulgn.T
  43.  ::
  44.  ::   zmenu***       sub-menu scripts
  45.  ::
  46.  ::  Main entry point for "call zmenu"
  47.  ::  string phones is used by ZCOMM as where to go to find scripts
  48.  ::  Symbols used in ZCOMM version:
  49.  ::
  50.  ::  YAM-type        ZCOMM-type
  51.  ::  menumode        fa12  str 1 ` \x60 on/off              z0
  52.  ::  menuinit        fa12  str 2        y/n                 z1
  53.  ::  menupage        fa12  str 3        e/1/2/3/4...        z2
  54.  ::  timezone        fa12  str 4        EST/EDT/CST/CDT...  z3
  55.  ::
  56.  ::  menufone        fa11  whole variable  %lib/zmnufon%page
  57.  ::
  58.  ::  modemspeed      fa10  whole variable
  59.  ::
  60.  ::  menutitle       fa9   whole variable
  61.  ::
  62.  ::  modeminit       fa8   whole variable
  63.  ::
  64.  ::  colordisplay    fa7   str 1 `      y/n
  65.  ::  colornormal     fa7   str 2        \E[0;33;1m yellow
  66.  ::  colorhigh       fa7   str 3        \E[0;31;1m red
  67.  ::
  68.  ::  menumsg         fa6   whole variable
  69.  ::  emulate         fa5   whole variable
  70.  ::  mndispl1        fa4   whole variable
  71.  ::  mndispl2        fa3   whole variable
  72.  ::                  fa2
  73.  ::  termmode        fa1   whole variable
  74.  ::
  75.  ::  (script stuff)
  76.  ::  myfirstname     fc11  whole variable
  77.  ::  mylastname      fc12  whole variable
  78.  ::  mycity          fc10  whole variable
  79.  ::  mystate         fc9   whole variable
  80.  ::  mypassword      fc8   whole variable (set by findq processing)
  81.  ::  rmtcript        fc7   whole variable (set by findq processing)
  82.  ::  rmttitle        fc6   whole variable (set by findq processing)
  83.  ::  myconnect       fc5   whole
  84.  ::  TSOuserid       fc4   whole
  85.  ::  TSOpasswd       fc3   whole
  86.  ::  rmtmsg          fc2   whole message text
  87.  ::  msglevel        fc1   whole numeric range 0-5 0 is silent
  88.  ::  menuhname       fs12  whole
  89.  ::  menuhscr        fs11  whole
  90.  ::
  91.  ::===  zmenu entry point
  92.  ::  If you call zmenu, then I assume you want to use menu system.
  93. zmenu: set phones zmenu.t
  94.  ::
  95.  ::  if menu system is not initialized, go do setup
  96.      if !%fa12 goto setup
  97.  ::
  98.  ::  display zmenu screen
  99.      type zmenu.scr
  100.  ::
  101.  ::  if user has defined a menu title line, display it, centered.
  102.      set ifs "`";split fa7
  103.      if %fa9 setn n1 79-%fa9/2
  104.      if %fa9 lput "\E[s\E[1;%n1\&H%z1 %fa9 \E[u%z2"
  105.  ::
  106.  ::  show the last command entered
  107.      set ifs "`";split fa7
  108.      if !%fa6 set fa6 "None"
  109.      lput "\E[2A\E[17C\E[35;1mLAST:  %fa6\&\E[u%z2"
  110.  ::
  111.  ::===  accept the one-character menu option that says what to do
  112.  ::
  113.      set ifs "`";split fa7
  114.      set s0 "";acceptl1 s0 "\E[3A\E[13C%z1\&_\E[1D\E[s%z2"
  115.  ::  Here's a branch table to go places based on user keyed input:
  116.      if is0,b goto zmnub
  117.      if is0,c goto zmnuc
  118.      if is0,d goto zmnud
  119.      if is0,e goto zmnue
  120.      if is0,g goto zmnug
  121.      if is0,h goto zmnuh
  122.      if is0,i cls;goto setup
  123.      if is0,k goto zmnuk
  124.      if is0,m goto zmnum
  125.      if is0,o goto zmnuo
  126.      if is0,p goto zmnup
  127.      if is0,q goto zmnuq
  128.      if is0,x goto zmnux
  129.      if is0,s goto zmnus
  130.      if is0,t goto zmnut
  131.      set fa6 "not recognized"
  132.      if afc1<4 goback zmenu
  133.      lput "\E[10;1H\E[J\E[1B\E[80D\E[0;36;1mOption %s0 not recognized"
  134.      lput "\E[1B\E[80DOn this panel, you are restricted to entering"
  135.      lput "\E[1B\E[80Djust those letters listed with the menu options."
  136.      lput "\E[1B\E[80DI will display help information now."
  137.      set s1 "-any key to continue-";setn n1 79-%s1/2
  138.      acceptl1 s0 "\E[1B\E[80D\E[%n1\&C%s1"
  139.      set fs12 "";goto zmnuhm
  140.  ::
  141.  ::===  Setup is called by ZCOMM on entry or on first call to zmenu.t
  142.  ::
  143. setup:
  144.  ::  If the script file exists, then use it for faster initialization
  145.      if !fzmnuparm.t goto setupcold
  146. setuphot:
  147.      sets s0 " source %drive:%home/zmnuparm.t";gosub execute
  148. userexit:
  149.      if f%lib/zmnuuser.t source %lib/zmnuuser.t
  150.      set fa6 "Menu system Initialized"
  151.  ::  menumode        fa12  str 1 `      on/off              z0
  152.  ::  menuinit        fa12  str 2        y/n                 z1
  153.  ::  menupage        fa12  str 3        e/1/2/3/4...        z2
  154.  ::  timezone        fa12  str 4        EST/EDT/CST/CDT...  z3
  155.      setc ifs "`";split fa12;set z1 y
  156.      setc fa12 "%z0\&`\&%z1\&`\&%z2\&`\&%z3\&`"
  157.      if iz0,off return
  158.      goback zmenu
  159.      ::
  160.      :: displayreset is used to return to a known mode after doing
  161.      :: strange things in remote logon scripts, maybe (for IBM with
  162.      :: Renex, in particular)  Among other things, it cancels keyboard
  163.      :: mapping which may be used with strange protocol converters.
  164. displayreset:
  165.      if %fa5 sets s0 "%fa5";gosub execute
  166.      if %fa4 sets s0 "%fa4";gosub execute
  167.      if %fa3 sets s0 "%fa3";gosub execute
  168.      mk
  169.      return
  170.  ::  This little routine simply waits for a number of intervals based
  171.  ::  on relative expertise as set in msglevel (fc1).
  172.  ::  This assumes that experts can read faster or don't need help at all.
  173. dwell:
  174.      setn n2 fc1*8;setn n1 0
  175. dwellloop:
  176.      setn n1 n1+8;if an1>n2 return
  177.      sleep 8;goback dwellloop
  178.  ::
  179.  ::  execute gosub supports use of temp file to issue commands
  180.  ::  on input:  s0 has command to execute
  181.  ::  This corresponds to the Pro-YAM "obey" command
  182. execute:
  183.      kill;ki;sets s1 "%dircx";sets dircx "%drive:%home";del zmnumain.tmp
  184.      create zmnumain.tmp;echof " %s0";close;source zmnumain.tmp
  185.      sets dircx "%s1";return
  186.  ::  This routine resets term mode to use-specified values
  187. termmode:
  188.      sets s0 "%dircx";sets dircx "%drive:%home";del zmnumain.tmp
  189.      create zmnumain.tmp;echof " ena %fa1";close;source zmnumain.tmp
  190.      sets dircx "%s0";return
  191.  ::
  192.  ::  This routine is meant to force a hangup.  It usually works.
  193. hangup: bye;o;pat
  194.      mk;dis -t;pat 0 "OK";sets s0 "speed %fa10";gosub execute
  195.      put "+++\r";sleep 5;put "ATH\r"
  196.      wait -f1
  197.      if !0 goto hangup
  198. hangupx: put "\r";pat;gosub displayreset
  199.      lput "\E[80D\E[K\E[1A\E[K\E[1A\E[K"
  200.      if afc1>0 if !jfa6,HUNG sets fa6 "%fa6 HUNG UP"
  201.      echo " MODEM HUNG UP ";if afc1>0 sleep 5
  202.      set ifs "`";split fa12;if i%z0,off return
  203.      if jfa6,BBS goto zmnub
  204.      goback zmenu
  205.   ::
  206.   :: inigrab input:  s0 set to string to find
  207.   :: and zmnuparm.ini contains init values: keyword value value
  208.   :: ZCOMM version of inigrab
  209. inigra